<%@page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8" %>
<%@page import="com.globalresources.commons.Constant" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<html>
<head><title>list UnSign Documents</title></head>
<SCRIPT type="text/javascript">
		function selectAll(){	
			var _cb = document.getElementById('select_all');
			var checkboxes = document.getElementsByTagName("input");
			for(var i=0; i<checkboxes.length; i++){
				var checkbox = checkboxes[i];
				if(checkbox.id != 'select_all' && checkbox.type == 'checkbox'){
				 	checkbox.checked = _cb.checked;
				}
			}
		}
		function viewDocuments(){
			var filenames = "";
			var checkboxes = document.getElementsByTagName("input");
			var aflag = true;
			var String
			for(var i=0; i<checkboxes.length; i++){
				var checkbox = checkboxes[i];
				if(checkbox.id != 'select_all' && checkbox.type == 'checkbox'){
				 	if(checkbox.checked == true){
				 		if(aflag == true){
				 			filenames =  checkbox.id;
				 		}else{
				 			filenames = filenames + "#spliter#" + checkbox.id;
				 		}
				 		aflag = false;
				 		
				 	}
				}//		alert(filenames);
			}
			//alert(filenames);
			if(aflag){
				alert("Please Select Document!");
			}else{
				var form = document.createElement('form');
				form.setAttribute('method','post');
				form.setAttribute('action','viewDocument.action');
				var input = document.createElement('input');
				input.setAttribute('type','hidden');
				input.setAttribute('name','filenames');
				input.setAttribute('value',filenames);
				
				form.appendChild(input);
				document.body.appendChild(form);
				form.submit();
			}
		}
		function signDocument(){
			var filenames = "";
			var checkboxes = document.getElementsByTagName("input");
			var aflag = true;
			var String
			for(var i=0; i<checkboxes.length; i++){
				var checkbox = checkboxes[i];
				if(checkbox.id != 'select_all' && checkbox.type == 'checkbox'){
				 	if(checkbox.checked == true){
				 		if(aflag == true){
				 			filenames =  checkbox.id;
				 		}else{
				 			filenames = filenames + "#spliter#" + checkbox.id;
				 		}
				 		aflag = false;
				 		
				 	}
				}
			}
			
			if(aflag){
				alert("Please Select Document!");
			}else{
				var form = document.createElement('form');
				form.setAttribute('method','post');
				form.setAttribute('action','signDocument.action');
				var input = document.createElement('input');
				input.setAttribute('type','hidden');
				input.setAttribute('name','filenames');
				input.setAttribute('value',filenames);
				form.appendChild(input);
				document.body.appendChild(form);
				form.submit();
			}
		}
		
		function signSelectedDocument(){		
		document.unSignDocumentEdit.submit();
		
		}
	</SCRIPT>
	<style type="text/css">
	<!--
	body {
		margin-left: 0px;
		margin-top: 0px;
		margin-right: 0px;
		margin-bottom: 0px;
		background-color: #EEF2FB;
	}
	-->
	</style>
	<link href="../images/skin.css" rel="stylesheet" type="text/css" />
<body >
	<form id="signDocument" name="signDocument" action="signDocument.action" method="post">
	<table width="100%" border="0" cellpadding="0" cellspacing="0">
		<tr>
			<td>
			 <table width="100%" border="0" cellpadding="0" cellspacing="0">
			 	<tr>
			 		<td width="17" valign="top" background="../images/mail_leftbg.gif"><img src="../images/left-top-right.gif" width="17" height="29" /></td>
				    <td valign="top" background="../images/content-bg.gif">
				    <table width="100%" height="31" border="0" cellpadding="0" cellspacing="0" class="left_topbg" id="table2">
				      <tr>
				        <td height="31" background="../images/">
				       → UnSigned Documents to Sign&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
				       <a href="../document/listUnSignDocuments.action">List UnSign Documents</a>
				     </td>
				      </tr>
				    </table></td>
				    <td width="16" valign="top" background="../images/mail_rightbg.gif"><img src="../images/nav-right-bg.gif" width="16" height="29" /></td>
			 	</tr>
			 </table>
			</td>    
		</tr>
		<tr>
			<td>
				<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#F7F8F9">
						<thead>
							<tr bgcolor="#deedf2">
								<th width="17" background="../images/mail_leftbg.gif"><img src="../images/mail_leftbg.gif" width="17" height="17" /></th>
								<th width="20" >
								 <input id="select_all" type="checkbox" onClick="selectAll();">
								</th>
								<th align="left" >
									Patient
								</th>
								<th align="left" >
									Hospital Name
								</th>
								
								<th align="left"> 
									Received time
								</th>
							
								<th width="16" background="../images/mail_rightbg.gif"><img src="../images/mail_rightbg.gif" width="16" height="17" /></th>
							</tr>
						
						</thead>
						<tbody>
					
					
							<s:iterator value="unSignDocumentEditList">
								   <tr>
									<td width="17" background="../images/mail_leftbg.gif"><img src="../images/mail_leftbg.gif" width="17" height="17" /></td>
                                   <td>
			                      <input id="documentCheckBox" type="checkbox" value="<s:property value="id"/>" checked>
			                      </td>
									<td align="left">
										<a href='../document/showUnsignDocumentFirst.action?id=<s:property value="id"/>&type=unsign'>
<s:if test="isView==0">
      <b>
      <s:property value="patient" /> 
      </b>
</s:if>
<s:else>
 <s:property value="patient" /> 
</s:else>
										
									
										 </a>
									</td>
									<td align="left">
									<s:if test="isView==0">
      <b>
    <s:property value="hospital.name" />
      </b>
</s:if>
<s:else>
 <s:property value="hospital.name" />
</s:else>
										
									</td>
									<td align="left">
								<s:property value="createTime" />
										
									</td>
									<td width="16" background="../images/mail_rightbg.gif"><img src="../images/mail_rightbg.gif" width="16" height="17" /></td>									 
								</tr>
							</s:iterator>
						
							<tr align="right">
								<td width="17" background="../images/mail_leftbg.gif"><img src="../images/mail_leftbg.gif" width="17" height="17" /></td>
								<td colspan="4" bgcolor="#d5dfdf" align="left">
							 &nbsp;&nbsp;&nbsp;
								</td>
								<td width="16" background="../images/mail_rightbg.gif"><img src="../images/mail_rightbg.gif" width="16" height="17" /></td>
							</tr>
						</tbody>
					</table>
			</td>
		</tr>
        <tr><td>
         <table width="100%" border="0" cellpadding="0" cellspacing="0">
			 	<tr>
			 		<td width="17" valign="top" background="../images/mail_leftbg.gif"><img src="../images/buttom_left2.gif" width="17" height="17" /></td>
				    <td valign="top">
                    
                    <table width="435" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td width="127">Reason</td>
    <td width="292"><input type="text" name="signReason" id="signReason"/></td>
  </tr>
  <tr>
    <td>Location</td>
    <td><input type="text" name="signLocation" id="signLocation"/></td>
  </tr>
  <tr>
    <td colspan="2"><input type="submit" value="Sign"/></td>
      </tr>
</table>

        </td>
				    <td width="16" valign="top" background="../images/mail_rightbg.gif"><img src="../images/buttom_right2.gif" width="16" height="17" /></td>
			 	</tr>
			 </table>
        
        
        </td></tr>
		<tr>
			<td>
			 <table width="100%" border="0" cellpadding="0" cellspacing="0">
			 	<tr>
			 		<td width="17" valign="top" background="../images/mail_leftbg.gif"><img src="../images/buttom_left2.gif" width="17" height="17" /></td>
				    <td valign="top" background="../images/buttom_bgs.gif"><img src="../images/buttom_bgs.gif" width="17" height="17"></td>
				    <td width="16" valign="top" background="../images/mail_rightbg.gif"><img src="../images/buttom_right2.gif" width="16" height="17" /></td>
			 	</tr>
			 </table>
			</td>    
		</tr>
	</table>
		</form>
</body>
</html>
